// 数据响应式
export function reactive(vm, __get__, __set__) {
  const _data = vm.$data;
  
  for (let key in _data) {
    // 把属性定义在this上，可直接this.xx访问
    Object.defineProperty(vm, key, {
      get() {
        __get__ && __get__(key, _data[key]);
        return _data[key];
      },
      set(newVal) {
        const oldVal = _data[key];
        _data[key] = newVal;
        __set__ && __set__(key, newVal, oldVal);
      }
    })
  }
}

// module.exports = reactive;